
<style>
	table.show {
		background-color: rgba(65, 240, 32, 0.1);
		padding: 10px;
		min-width: 900px;
		padding: 10px;

	}
	table.Innershow {
		background-color: rgba(65, 240, 32, 0.26);
		padding: 10px;
		padding: 10px;
		color:black;
		margin:5px;

	}
	td {
		padding: 3px;
	}
</style>
<div class="text-section" id="opa">
	<h1>Поръчки</h1>

	<p>Нови поръчки .</p>
</div>
<table class="show">
	<?php
	 foreach ($orders as $order){
		 echo " <tr>
		            <td width='130px'>
						".$order->getShop()->getName()."
		            </td>
		            <td width='200px'>
						".$order->getShop()->getAddress()."
		            </td>
		            <td width='100px'>
						".$order->getShop()->getPhone()."
		            </td>
		            <td>
						".$order->getShop()->getDelivery()."
		            </td>
		            <td>
		                <table class='Innershow' >";
						 foreach($order->getStocks() as $stock ){
							 echo "	<tr>
							           	<td width='150px'>
											".$stock->getName()."
							           	</td width='50px'>
							           	<td>
											".$stock->getOrderQuantity()."
							           	</td>
							           	<td>
											".$stock->getQuantity()."
							           	</td>";

						 }
		 echo"          </table>
				    </td>
		            <td>
						".$order->getSum()." лв.
		            </td>
		            <td>
						<input type='button' id='".$order->getId()."' class='myButton' value=' Приета '><br/>
						<input type='button' id='".$order->getId()."' class='myButton' value='Отказана'>
		            </td>

				</tr>";
	 }

	?>



</table>
<script>
	$.get( "cntrlr/countOrders.php", { ajax : true } )
		.done(function( data ) {
			$("#newOrdersCount").html( data );
		});
	$(".myButton").click(function(){
		var id = $(this).attr("id");
		var button = $(this).val();
		$.get("cntrlr/NewOrders.php", { id: id , value : button}).done(function(data) {
			$("#tab-1 article").html(data);

		});
	});
</script>
